﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FubiManger.UI;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class specscontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public specscontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        /// <summary>
        /// 编号
        /// </summary>
        public int index { get; set; }
        public string key { get; set; }
        public string value { get; set; }
        /// <summary>
        /// 1新增2显示
        /// </summary>
        public string stype { get; set; }

            
        private void txtvalue_TouchLeave(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtkey.Text) && !string.IsNullOrEmpty(txtvalue.Text))
            {
                ((SpecsFrom)this.Form).Setspecs(txtkey.Text, txtvalue.Text);//设置规格
            }
        }

        private void specscontrol_Load(object sender, EventArgs e)
        {
            if (stype == "2")
            {
                txtkey.ReadOnly = true;
                txtvalue.ReadOnly = true;
                txtkey.Text = key;
                txtvalue.Text = value;
            }
        }
        /// <summary>
        /// 删除规格
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pandel_Press(object sender, EventArgs e)
        {
            ((SpecsFrom)this.Form).Delspecs(index);
        }
    }
}